﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Agents.Agent
{
    //On this page the Agent writes his current location- and is redirected to the map page
    //with him and all clients on it.
    public partial class Map : System.Web.UI.Page
    {
        string city, street, number;
        protected void Page_Load(object sender, EventArgs e)
        {
            //retrieving the address information from textbaxes.
            city = cityTxtbox.Text;
            street = streetTxtbox.Text;
            number = numberTxtbox.Text;
        }

        protected void backBtn_Click(object sender, EventArgs e)
        {
            //redirecting the agent back to his homepage without doing anythin.
            Response.Redirect("~/Agent/AgentMenu.aspx");
        }

        protected void okBtn_Click(object sender, EventArgs e)
        {
            if (city == "" || street == "" || number == "") { }

            //only if the addressm was written- redirect to the next page.  
            else
            {
                //saving the adrress in the proper format.
                string address = city + "," + street + "," + number;
                //redirecting to the page with the map.
                Response.Redirect("CustomersOnMap.aspx?address=" + address);
            }
        }
    }
}